home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Object Demo
- ** -----------
- ** Opens a screen according to the settings in an object file. See
- ** asm/UsingObjects/OBJScreen.s for the object definitions.
- **
- ** To compile with SAS/C:
- **
- ** 1> sc OBJScreen.c link startup=LIB:gms.o data=far
- **
- */
-
- #include <proto/games.h>
-
- extern struct GMSBase *GMSBase;
- ULONG _XCEXIT = NULL;
- ULONG PREFSNAME = DEFAULT;
-
- void main(void)
- {
- struct GameScreen *GameScreen;
- struct Picture *Picture;
- APTR OBJBase;
-
- if (OBJBase = LoadObjectFile("GMS:demos/data/OBJ.Screen")) {
- if (Picture = GetObject(OBJBase,"Picture")) {
- if (LoadPic(Picture)) {
- if (GameScreen = (struct GameScreen *) GetScreen()) {
- GameScreen->MemPtr1 = Picture->Data;
- GameScreen->ScrWidth = Picture->Width;
- GameScreen->ScrHeight = Picture->Height;
- GameScreen->PicWidth = Picture->Width;
- GameScreen->PicHeight = Picture->Height;
- GameScreen->Planes = Picture->Planes;
- GameScreen->AmtColours = Picture->AmtColours;
- GameScreen->ScrMode = Picture->ScrMode;
- GameScreen->ScrType = Picture->ScrType;
- GameScreen->Palette = Picture->Palette;
- GameScreen->Attrib = CENTRE;
-
- if (AddScreen(GameScreen)) {
- ShowScreen(GameScreen);
- WaitLMB();
- }
- DeleteScreen(GameScreen);
- }
- FreePic(Picture);
- }
- }
- FreeObjectFile(OBJBase);
- }
- }
-
-